package com.atguigu.tingshu.album.service.impl;

import com.atguigu.tingshu.album.mapper.AlbumAttributeValueMapper;
import com.atguigu.tingshu.album.service.AlbumAttributeValueService;
import com.atguigu.tingshu.model.album.AlbumAttributeValue;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.simpleframework.xml.Attribute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * AlbumAttributeValueServiceImpl Album_Attribute_Value表
 *
 * @author Petrichor
 * @version 2023/12/26 20:17
 **/
@Service
public class AlbumAttributeValueServiceImpl implements AlbumAttributeValueService {
    
    private final AlbumAttributeValueMapper albumAttributeValueMapper;
    
    @Autowired
    public AlbumAttributeValueServiceImpl(AlbumAttributeValueMapper albumAttributeValueMapper) {
        this.albumAttributeValueMapper = albumAttributeValueMapper;
    }

    /**
     * @description: 根据专辑id查询专辑属性值
     * @author Petrichor
     * @date 2023/12/26 20:18
     * @param albumId 专辑id
     * @return  AlbumAttributeValue 专辑属性值
     **/
    @Override
    public List<AlbumAttributeValue> findAlbumAttributeValueByAlbumId(Long albumId) {
        // 创建LambdaQueryWrapper对象封装请求参数
        LambdaQueryWrapper<AlbumAttributeValue> lambdaQueryWrapper = new LambdaQueryWrapper<>() ;
        lambdaQueryWrapper.eq(AlbumAttributeValue::getAlbumId , albumId) ;

        // 根据专辑的id查询专辑的属性值
        List<AlbumAttributeValue> albumAttributeValueList = albumAttributeValueMapper.selectList(lambdaQueryWrapper);

        // 返回
        return albumAttributeValueList;
    }
}


